package policy.branches;

public class ActionBranch extends Branch {
	public final static String ALLOW = "allow";
	public final static String DENY = "deny";

	private int rule;
	private int anomaly;

	protected ActionBranch(String value, int rule) {
		super(value, null);
		this.rule = rule;
	}

	public int compareTo(Branch other) {
		if (other instanceof ActionBranch) {
			ActionBranch o = (ActionBranch) other;
			if (value.equals(o.getValue()))
				return 0;
			if (o.getValue().equals(ActionBranch.ALLOW)
					&& value.equals(ActionBranch.DENY))
				return -1;
			return 1;
		}
		return 0;
	}
	
	public int getRule() {
		return rule;
	}
	
	public void setAnomaly(int anomaly) {
		this.anomaly = anomaly;
	}
	
	public int getAnomaly() {
		return anomaly;
	}
}
